<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>12-复杂数据类型传参</title>
</head>
<body>
    <script>
        // 复杂数据传参
        function Hero(name){
            this.name = name;
        }

        function change(x){
             // let x;
            // x = yuji;
            console.log(x.name);  // 2. 虞姬
            x.name = '貂蝉';
            console.log(x.name);  // 3. 貂蝉 
        }
        var yuji = new Hero('虞姬');
        console.log(yuji.name);     // 1. 虞姬
        change(yuji);
        
        console.log(yuji.name);   // 4. 貂蝉 
    </script>
</body>
</html>